package com.wayhome.srpingbootmybatis.fileimportmanager.service.impl;

import com.wayhome.srpingbootmybatis.config.ApiResult;
import com.wayhome.srpingbootmybatis.fileimportmanager.bo.FileImportRlstBO;
import com.wayhome.srpingbootmybatis.fileimportmanager.dao.FileImportRlstDAO;
import com.wayhome.srpingbootmybatis.fileimportmanager.dto.ImportFileDTO;
import com.wayhome.srpingbootmybatis.fileimportmanager.dto.ImportFileRlstDTO;
import com.wayhome.srpingbootmybatis.fileimportmanager.dto.QImportRlstDTO;
import com.wayhome.srpingbootmybatis.fileimportmanager.service.FileImportRlstService;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Service
public class FileImportRlstServiceImpl implements FileImportRlstService {

    @Resource
    private FileImportRlstBO fileImportRlstBO;
    @Resource
    private FileImportRlstDAO fileImportRlstDAO;

    @Override
    public ApiResult importFile(ImportFileDTO importFileDTO) throws Exception {
        return fileImportRlstBO.saveImportFileRlst(importFileDTO);
    }

    @Override
    public ApiResult<List<ImportFileRlstDTO>> queryImportRlstPage(QImportRlstDTO qImportRlstDTO) throws Exception {
        List<ImportFileRlstDTO> list = fileImportRlstDAO.queryImportRlstList(qImportRlstDTO);
        return ApiResult.success(list);
    }

    @Override
    public void downImportRlstFile(QImportRlstDTO qImportRlstDTO) throws Exception {

        fileImportRlstBO.downImportRlstFile(qImportRlstDTO);
    }

    @Override
    public void downTemplate(QImportRlstDTO qImportRlstDTO) throws Exception {
        fileImportRlstBO.downTemplate(qImportRlstDTO);
    }

    @Override
    public ApiResult<Boolean> saveAsyncTask(QImportRlstDTO qImportRlstDTO) throws Exception {
        return ApiResult.success(fileImportRlstBO.saveAsyncTask(qImportRlstDTO));
    }


}
